package com.example.t470p.facechecktickets.Utils;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;

import java.io.File;
import java.io.FileInputStream;

public class pathUtils {
    /*
     * 获取Bitmap图
     */
    public static Bitmap GetBitmapByPath(String Path)
    {
        Bitmap bitmap = null;
        try {
            FileInputStream fis = new FileInputStream(Path);
            bitmap  = BitmapFactory.decodeStream(fis);
        } catch (Exception e) {
            // TODO: handle exception
            // System.out.println(e.getMessage());
        }
        return bitmap;
    }

    /*
     * 获取SD卡路径
     */
    public static String getSDPath(){
        File sdDir = null;
        boolean sdCardExist = Environment.getExternalStorageState()
                .equals(android.os.Environment.MEDIA_MOUNTED);//判断sd卡是否存在
        if(sdCardExist)
        {
            sdDir = Environment.getExternalStorageDirectory();//获取跟目录
        }
        return sdDir.toString();
    }
}
